package cn.seecoder.ai.model.po;

import cn.seecoder.ai.dao.converter.TrainParamsConverter;
import cn.seecoder.ai.enums.MachineLearningAlgorithmEnum;
import cn.seecoder.ai.enums.TrainParamEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import javax.persistence.*;
import java.util.List;
import java.util.Map;

/**
 * 机器学习流水线
 * @author fanyanpeng
 * @date 2023/4/9 22:14
 */

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Data
@Entity
@Table(name = "machine_learning_pipeline", schema = "seecoder_ai", catalog = "")
public class MachineLearningPipeline {

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "id")
    private Integer id;

    @Basic
    @Column(name = "user_id")
    private Integer userId;

    @Basic
    @Column(name = "pipeline_name")
    private String pipelineName;

    @Basic
    @Column(name = "label")
    private String label;

    @Basic
    @Enumerated(EnumType.STRING)
    @Fetch(FetchMode.SUBSELECT)
    @Column(name = "machine_learning_algorithm")
    private MachineLearningAlgorithmEnum machineLearningAlgorithm;


    @ElementCollection(fetch = FetchType.EAGER)
    private List<String> features;

    @Basic
    @Convert(converter = TrainParamsConverter.class)
    @Column(name = "train_params")
    private Map<TrainParamEnum,Object> trainParams;



}

